
class Person:
    def __init__(self, name):
        self.name = name
        self.age = 18

    def eat(self):
        print(self.name + '正在吃饭')

    def run(self):
        print(self.name + '正在跑步')


class Student(Person):  # 多重继承时，搜索顺序按照（）内顺序从左到右广度优先
    def __init__(self, name):
        print('------Student-init')
        super().__init__(name)  # 继承父类的初始化方法,使用super()表示父类对象,如果父类init方法有参数，这里也必须有参数。普通方法不需要


class Employee(Person):
    pass


class Doctor(Person):
    pass


s = Student('Jack')
s.run()
# e = Employee()
# d = Doctor()

# import random
# class Road:
#     def __init__(self, name, len):
#         self.name = name
#         self.len = len
#
#
# class Car:
#     def __init__(self, brand, speed):
#         self.brand = brand
#         self.speed = speed
#
#     def get_time(self, road):
#         randtime = random.randint(1, 10)
#         msg = '{}品牌的车在{}上以{}速度行驶{}小时'.format(self.brand, road.name, self.speed, randtime)
#         print(msg)
#
#     def __str__(self):
#         return '{}品牌的，速度{}'.format(self.brand, self.speed)
#
#
# r = Road('京藏公路', 12000)
# r.name = '京广高速'
# audi = Car('奥迪', 120)
# print(audi)
# audi.get_time(r)  # 将对象传入
